import {config} from "../config";

export const getUsersNamePromise = () => {
    const api = `${config.baseUrl}getUsersName`
    return fetch(api, {method:"GET"}).then(res => {
        return res.text();
    })
}

export const updateUserStatePromise = (name, state) => {
    const api = `${config.baseUrl}updateUserState/${name}?state=${state}`
    return fetch(api, {method:"PUT"}).then(res => {
        return res.text();
    })
}

export const updateDisMax = (max) => {
    const api = `${config.baseUrl}updateDisMax/${max}`
    return fetch(api, {method:"PUT"}).then(res => {
        return res.text();
    })
}

export const getDisMax = () => {
    const api = `${config.baseUrl}getDisMax`
    return fetch(api, {method:"GET"}).then(res => {
        return res.text();
    })
}

export const getUsersPromise = () => {
    const api = `${config.baseUrl}getUsers`
    return fetch(api, {method:"GET"}).then(res => {
        return res.text();
    })
}
